// #ifdef VUE3
import {
	reactive
} from 'vue'
// #endif
import util from './librarys/util'
import mixinBase from './librarys/mixins/base-mixin'
import iconsConfig from './librarys/config/icons'
import colorsConfig from './librarys/config/colors'
import stylesConfig from './librarys/config/styles'
import propsConfig from './librarys/config/props'

const install = (Vue) => {
	// #ifdef VUE2
	uni.$ff = Vue.observable({
		'util': util,
		'config': {},
		'pay': {
			'list': [],
		},
	})
	// #endif
	// #ifdef VUE3
	uni.$ff = reactive({
		'util': util,
		'config': {},
		'pay': {
			'list': [],
		},
	})
	// #endif
	Object.defineProperty(uni.$ff, 'safeAreaInsets', {
		get: function() {
			let safeAreaInsets = {
				bottom: 0,
				left: 0,
				right: 0,
				top: 0,
			}
			const windowInfo = uni.getWindowInfo()
			const deviceInfo = uni.getDeviceInfo()
			if (windowInfo) {
				safeAreaInsets = windowInfo.safeAreaInsets
				if (deviceInfo && safeAreaInsets.bottom > 0) {
					if (deviceInfo.osName === 'ios' && safeAreaInsets.bottom === 34) {
						safeAreaInsets.bottom = 19
					}
				}
			}
			return safeAreaInsets
		}
	})
	Vue.mixin(mixinBase)
}

export default {
	install
}